package com.tutou.ikuser.mapper;

import com.tutou.ikuser.pojo.dto.UserDTO;
import com.tutou.ikuser.pojo.po.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;


@Mapper
public interface UserMapper {
    @Select("select * from users where phone=#{index} or user_id=#{index}")
    User selectUser(String index);

    @Insert("insert into users (username, password, avatar_url,phone) values(#{userName},#{password},#{avatarUrl},#{phone}) ")
    void register(UserDTO userDTO);

    @Update("update users set username=#{userName} , password=#{password} where user_id=#{userId}")
    void update(User user);
}
